<?php

use yii\helpers\Url;
use yii\helpers\Html;
use frontend\assets\AppAsset;

/* @var $this yii\web\View */
AppAsset::register($this);
//AppAsset::addScript($this, '@web/js/officeHall/packageLog/projectDetails.js');
AppAsset::addScript($this, '@web/js/officeHall/packageLog/AssetPackageDetails.js');
AppAsset::addScript($this, '@web/js/officeHall/packageLog/paging.js');
AppAsset::addScript($this, '@web/js/officeHall/projectLog/operationLog.js');
AppAsset::addScript($this, '@web/js/officeHall/projectLog/pager.js');
AppAsset::addScript($this, '@web/js/single-project-top-img.js');


$this->title = '项目操作日志';
?>

<?= Html::cssFile('@web/css/packageLog/paging.css') ?>
<?= Html::cssFile('@web/css/obeationLog.css') ?>
<style type="text/css">
.wrap {
	    margin-top: 137px!important;
}
		/*//操作日志*/
.caoZuoRiZhi table tr td:last-child span,
.shuJuGengXin table tr td:last-child span{
	color: #2194f1!important;
	cursor: pointer;
}
.wrap > .container-fluid > .container{width: 100%; padding: 0; margin: 0; }

.edit-tabs-ul1>li>a{
    display: inline-block;
    width: 105px;
    margin-left: -10px;
}
</style>
   <!--一键置 顶-->
    <a href="#" class="clicktop" title="返回顶部">
        <!--<img src="image/common/clickTop.png" alt=""  />-->
    </a>

<?php echo \Yii::$app->view->renderFile('@app/views/project/project-detail-top.php', ['Base' => $topData['Base'], 'packageName' => $topData['packageName'],'data'=>$topData,
    'userChief'=>$topData['userChief'],'user'=>$topData['user'],'teamInfo'=>$topData['teamInfo'], 'projectModel'=>$projectModel,
    'team'=>$topData['team'],'teamXZR'=>$topData['teamXZR'], 'teamFZR'=>$topData['teamFZR'],'teamZJ'=>$topData['teamZJ']]); ?>


    <!-- 页内导航   开始-->
    <div class="container edit-tabs navFix">
        <div class="row">
            <div class="navFixTop"></div>
            <ul class="edit-tabs-ul1 ">
                <li class="pull-left  edit-tabs-li1">
                    <a href="<?php echo Url::toRoute(['project/getinfodata', 'package_id' => $data['package_id'], 'project_id' => $data['project_id']]); ?>">预评估信息</a>
                    <ul class="edit-tabs-ul2 myActiveBox" style="display: none;">
                        <li class="pull-left myActive"><a href="###">基本信息</a></li>
                        <li class="pull-left "><a href="###">司法进展</a></li>
                        <li class="pull-left "><a href="###">价值评估</a></li>
                        <li class="pull-left "><a href="###">补充说明</a></li>
                        <li class="pull-left "><a href="###">转让信息</a></li>
                        <li class="pull-left "><a href="###">流转、前期处置及维护情况</a></li>
                        <li class="pull-left "><a href="###">团队成员</a></li>
                    </ul>
                </li>

                <li class="pull-left edit-tabs-li1 myActiveBox">
                    <a href="<?php echo Url::toRoute(['project-investigation/index', 'package_id' => $data['package_id'], 'project_id' => $data['project_id']]); ?>">尽调报告</a>
                    <ul class="edit-tabs-ul2" style="display: none;">
                        <li class="pull-left "><a href="###">债权基本情况</a></li>
                        <li class="pull-left "><a href="###">借款人及资产情况</a></li>
                        <li class="pull-left "><a href="###">保证人及资产情况</a></li>
                        <li class="pull-left "><a href="###">抵押人及抵押物情况</a></li>
                        <li class="pull-left "><a href="###">其他承债人及资产情况</a></li>
                        <li class="pull-left "><a href="###">尽调评估总结</a></li>
                        <li class="pull-left "><a href="###">关键附件</a></li>
                    </ul>
                </li>
                <li class="pull-left edit-tabs-li1">
                    <a href="<?php echo Url::toRoute(['project/access-audit', 'package_id' => $data['package_id'], 'project_id' => $data['project_id']]); ?>">审核情况</a>
                    <ul class="edit-tabs-ul2" style="display: none;">
                        <li class="pull-left myActive "><a href="###">审核状况</a></li>
                    </ul>
                </li>
                <li class="pull-left edit-tabs-li1 myActiveBox active ">
<!--                    <a href="--><?php //echo Url::toRoute(['project-log/index', 'package_id' => $data['package_id'], 'project_id' => $data['project_id']]); ?><!--">操作日志</a>-->
                    操作日志
                    <ul class="edit-tabs-ul2 myUl operationLogLi">
                        <li class="pull-left myActive"><a data-href="#caoZuo">操作记录</a></li>
                        <li class="pull-left"><a data-href="#shuJu">数据更新纪录</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <!-- 页内导航   结束-->

    <!--操作日志-->
    <div class="caoZuoRiZhi" id="caoZuo">
        <div class="container containerShadow">
            <div class="row">
                <div class="topimg">
                    <div class="left pull-left">
                        <span>操作记录</span>
                    </div>
                </div>

                <?php if (!empty($projectLogs) && is_array($projectLogs)) { ?>
                    <table class="tableRaius" border="0" cellspacing="0" cellpadding="0"
                           style="border-collapse:separate;border-spacing: 0;">
                        <tr>
                            <td>序号</td>
                            <td>操作时间</td>
                            <td>操作人</td>
                            <td>操作内容</td>
                        </tr>
                            <?php
                            $i = 1;
                            foreach ($projectLogs as $key=>$value) { ?>
                                <tr>
                                    <td>
                                <span class="txt-cut-one">
                                    <?php /*echo Html::encode($value['id']); */?>
                                    <?php echo $i++; ?>
                                </span>
                                    </td>
                                    <td>
                                <span class="txt-cut-one">
                                    <?php echo Html::encode($value['created_at']); ?>
                                </span>
                                    </td>
                                    <td>
                                <span class="txt-cut-one" title="<?php echo Html::encode($value['user_id']); ?>">
                                    <?php echo Html::encode($value['user_id']); ?>
                                </span>
                                    </td>
                                    <td>
                                <span class="txt-cut-one" title="<?php echo Html::encode($value['log']); ?>">
                                    <?php echo Html::encode($value['log']); ?>
                                </span>
                                    </td>
                                </tr>
                            <?php } ?>
                    </table>
                <?php } else { ?>
                    <div style="text-align:center; margin:0 auto;">
                        <?php echo Html::img('@web/image/defaultPage/nothing.png',['style'=>'display:inline-block;width:100%']); ?>
                    </div>
                <?php } ?>
            </div>
        </div>
    </div>


    <!--数据更新记录-->
    <div class="shuJuGengXin" id="shuJu">
    <div class="container containerShadow update_log">
        <div class="row">
            <div class="topimg">
                <div class="left pull-left">
                    <span>数据更新记录</span>
                </div>
                <div class="pull-right">
                    <?php if (!empty($data['data']) && is_array($data['data'])) { ?>
                        <select name="" style="width: 98px;">
                            <option value="">一周内</option>
                            <option value="" selected="selected">一个月内</option>
                            <option value="">一个月前</option>
                        </select>

                        <select name="module" style="padding: 0 5px; width: auto;">
                            <?php if (!empty($modules) && is_array($modules)) { ?>
                                <?php
                                foreach ($modules as $k => $v) {
                                    echo "<option value='{$k}' >{$v}</option>";
                                }
                                ?>
                                <option value="0" selected="selected">所属模块</option>
                            <?php } ?>
                        </select>

                        <select name="user" style="width: 98px;">
                            <?php if (!empty($projectUpdateLogUsers) && is_array($projectUpdateLogUsers)) { ?>
                                <?php
                                foreach ($projectUpdateLogUsers as $k => $v) {
                                    echo "<option value='{$k}' >{$v}</option>";
                                }
                                ?>
                            <?php } ?>
                            <option value="0" selected>操作人</option>
                        </select>
                    <?php } ?>
                </div>
            </div>

            <?php if (!empty($data['data']) && is_array($data['data'])) { ?>
                <table class="tableRaius" border="0" cellspacing="0" cellpadding="0" style="border-collapse:separate;border-spacing: 0;">
                    <tr id="page_list_tr">
                        <td>序号</td>
                        <td class="operationTime">
                            操作时间<span id="" class="caret table-dow"></span>
                        </td>
                        <td>操作人</td>
                        <td class="operationTime">
                            所属模块<span id="" class="caret table-dow"></span>
                        </td>
                        <td>操作内容</td>
                    </tr>

                    <?php
                    $j = 1;
                    if (!empty($data['data']) && is_array($data['data'])) { ?>
                        <?php foreach ($data['data'] as $key => $value) { ?>
                            <tr class="show_log">
                                <td>
                                    <?php /*echo Html::encode($value['id']); */?>
                                    <?php echo $j++; ?>
                                </td>
                                <td><?php echo Html::encode($value['created_at']); ?></td>
                                <td><?php echo Html::encode($value['user_id']); ?></td>
                                <td>
                                	<span class="txt-cut-one" style="padding-left: 15px;" title="<?php echo Html::encode($value['module']); ?>">
	                                    <?php echo Html::encode($value['module']); ?>
	                                </span>	
                                </td>
                                <td>
	                                <span class="txt-cut-one" style="padding-left: 8px;" title="<?php echo Html::encode($value['log']); ?>">
	                                    <?php echo Html::encode($value['log2']); ?>
	                                </span>
                                </td>
                            </tr>
                        <?php } ?>
                    <?php } ?>
                </table>

                <input type="hidden" id="project_id" name="project_id" value="<?php echo $data['project_id']; ?>">

                <!--//分页部分-->
                <div class="pagingBox">
                    <div id="page_list" class="pull-left">
                        <?php echo $data['pager']; ?>
                    </div>
                    <div class="pagingNumber">
                    <span class="pageTotal pull-left">
                        <span class="pageT"></span> 每页
                        <a id="list">
                            <span class="number">20</span>
                            <ul class="pageTotalBox">
                                <li>10</li>
                                <li class="pageActive">20</li>
                                <li>30</li>
                                <li>40</li>
                                <li>50</li>
                            </ul>
                        </a>
                        <b class="caret"> </b>行
                    </span>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;共<span class="totalSize"><?php echo $data['count']; ?></span>&nbsp;&nbsp;&nbsp;条记录
                        <input type="hidden" id="current_page" value="<?php echo $data['page'] ?>">
                        <input type="hidden" id="project_log_url" value="<?php echo Url::toRoute('project-log/page', true);?>"/>
                        <input type="hidden" id="project_id" value="<?php echo $data['project_id']; ?>"/>
                        <input type="hidden" id="package_id" value="<?php echo $data['package_id']; ?>"/>

                        <!--                        <div class="form-group pull-right ">-->
                        <!--                            <label for="rePage">跳转到 </label>-->
                        <!--                            <input type="text" class="form-control" placeholder=" 0" style="display:inline-block;width: 60px; height: 30px;"-->
                        <!--                                   id="rePage"/>-->
                        <!--                            页-->
                        <!--                        </div>-->
                    </div>
                </div>
            <?php } else { ?>
                <div style="text-align: center;">
                    <?php echo Html::img('@web/image/defaultPage/nothing.png',['style'=>'display:inline-block;width:100%']); ?>
                </div>
            <?php } ?>

        </div>
    </div>
    <!--底部-->


    <!-- 4.模态窗口    开始  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
    <input type="hidden" class="btn btn-primary btn-lg modal_log_show" data-toggle="modal"
           data-target="#project-log-show"/>
    <!-- Modal -->
    <div class="modal fade" id="project-log-show" tabindex="-1" role="dialog"
         aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true"><img src="/image/assetPackage/close.png"></span></button>
                    <div class="pull-left modal-nav">
                        <img src="/image/assetPackage/white.png" class="pull-left">
                        <span class="pull-left">操作内容</span>
                    </div>
                </div>
                <div class="modal-body-approval">
                    <div class="modal-body-approval-div">
                    <pre style="font-size: 14px; font-family: 'Microsoft YaHei', Tahoma, Arial;background: #fff;color: #333;border: none;">
                        数据更新记录操作内容详情
                    </pre>
                    </div>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-primary btns-primary modal_log_btn">确定</button>
                </div>
            </div>
        </div>
    </div>
    <!-- 模态窗口  结束!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

<?php
$js = <<<JS
$(function() {
     $(function() {
     	
        var project_id = $('#project_id').val(),
            package_id = $('#package_id').val();
      
        $(".like").on('click', function () {
            var value = $(this).attr('data').split('-');
            var url = '/project/set-project-like';
            if (value[2] == 2) {
                url = '/project/set-project-light';
            }
            $.get(url, {'project_id': project_id, 'del': value[1], 'type': value[2]}, function (res) {
                if (res.status) {
                    $("#" + value[0] + "_img").attr('src', res.img);
                    $("#" + value[0]).attr('data', value[0] + '-' + res.type + '-' + value[2]);
                    if (res.type == 1 && value[2] == 1) {
                        $('#myModalLabel').modal('show');
                    } else {
                        layer.msg(res.msg);
                    }
                } else {
                    layer.msg(res.msg);
                }
            });
       });
        
        $(document).on('click', '#getBase,#getJudicial,#getPingGu,#getExplain,#getMake,#getMain,#getTeam', (function () {
            var postionVal = $(this).data('val');
            $.get('/project/get-base-data', {
                'project_id': project_id,
                'postion': postionVal,
                'package_id': package_id
            }, function (res) {
                switch (postionVal) {
                    case 1:
                        $("#jiBenXinXiEdit").html(res);
                        $("#jiBenXinXiEdit").show();
                        $(".jiBenXinXiW").hide();
                        break;
                    case 3:
                        $(".siFaEdit").html(res);
                        $(".siFaEdit").show();
                        $(".siFaW").hide();
                        break;
                    case 5:
                        $(".jiaZhiPingGuEdit").html(res);
                        $(".jiaZhiPingGuEdit").show();
                        $(".jiaZhiPingGuW").hide();
                        break;
                    case 7:
                        $(".buChongShuoMingEdit").html(res);
                        $(".buChongShuoMingEdit").show();
                        $(".buChongShuoMingW").hide();
                        break;
                    case 9:
                        $(".zhuanRangXinXiEdit").html(res);
                        $(".zhuanRangXinXiEdit").show();
                        $(".zhuanRangXinXiW").hide();
                        break;
                    case 11:
                        $(".liuZhuanJiWieHuEdit").html(res);
                        $(".liuZhuanJiWieHuEdit").show();
                        $(".liuZhuanJiWieHuW").hide();
                        break;
                    case 13:
                        $(".tuanDuiChengYuanEdit").html(res);
                        $(".tuanDuiChengYuanEdit").show();
                        $(".tuanDuiChengYuanW").hide();
                        break;
                    default:
                        $("#jiBenXinXiEdit").html(res);
                        $("#jiBenXinXiEdit").show();
                        $(".jiBenXinXiW").hide();
                        break;
                }
            })
        }))
    })});
    
    //头部交互效果

	$(document).on('scroll', function() {
		//动态添加导航背景色
		var idList = ["caoZuo","shuJu"];
	 	for(var i = 0; i < idList.length; i++){
	 		  var id = idList[i];
	 		  var top = $('#'+ id).offset().top-getScrollTop();
	 		  var str = -($('#'+ id).height()+118);
	 		if(top < 118 && top > str){
		 		$('.myUl li').eq(i).addClass('myActive').siblings().removeClass('myActive');
		 	}
	 	}
	})
	
	/**
	 * 获取页面滚动距离

	 * @return 支持IE6
	 */
	function getScrollTop() {
		var scrollPos;
		if(window.pageYOffset) {
			scrollPos = window.pageYOffset;
		} else if(document.compatMode && document.compatMode != 'BackCompat') {	
			scrollPos = document.documentElement.scrollTop;
		} else if(document.body) {
			scrollPos = document.body.scrollTop;
		}
		return scrollPos;
	}

JS;
$this->registerJs($js);